package com.haiheng.voiceandbook.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.haiheng.voiceandbook.R
import com.haiheng.voiceandbook.utils.DateUtil
import com.haiheng.voiceandbook.utils.ToolUtil

import com.ximalaya.ting.android.opensdk.model.track.Track
import java.util.*

class TrackAdapter(layoutResId: Int, data: List<Track>?) :
    BaseQuickAdapter<Track, BaseViewHolder>(layoutResId, data) {
    private val TAG = "TrackAdapter"

    override fun convert(helper: BaseViewHolder?, item: Track?) {
        helper?.run {
            setText(R.id.name, item?.trackTitle)
            setText(R.id.tv_count, ToolUtil.getFormatNumber(item?.playCount?.toLong()))
            setText(R.id.tv_time, DateUtil.dateToString("mm:ss", item?.duration?.toLong()?.let { Date(it*1000) }))
        }


    }


}